import java.util.Random;
import java.util.Scanner;

/**
 * If there are no bugs, it was created by Chen FengYao on 2018/4/2;
 * Otherwise, I don't know who created it either
 */

public class Question3 {
    public static void main(String[] args) {
        /*
        1. 用户有5000元
        2. 用户输入大小(0-大,1-小)
        3. 生成三个1-6 的随机数作为骰子
        4. 根据点数和 判断大小
        5. 根据点数大小,和用户输入的大小进行比较,
            如果一致,用户金额+50
            如果不一致, 用户金额 -50
        6. 用户没钱了 让他退出
        7. 循环 2-6
        */
        Scanner scanner = new Scanner(System.in);
        Random random = new Random();

        int money = 5000;
        while (true) {
            //TODO 代码还可以优化,现在没时间了
            int guess = scanner.nextInt();

            int dice1 = random.nextInt(6) + 1;
            int dice2 = random.nextInt(6) + 1;
            int dice3 = random.nextInt(6) + 1;

            int sum = dice1 + dice2 + dice3;

            int result = sum > 10 ? 0 : 1;

            System.out.println(dice1 + "," +
                    dice2 + "," + dice3);

            if (result == guess) {
                // 赢
                money = money + 50;
            } else {
                // 输
                money = money - 50;
            }

            System.out.println("还有:" + money);

            if (money <= 0){
                System.out.println("没钱了");
                break;
            }
        }
    }
}
